import pandas as pd
import os
import csv

column = None
all_value = None
for filename in os.listdir("."):
    if filename.find(".csv") != -1:
        df = pd.read_csv(filename)
        if column is None:
            column = df.columns
        values = df.values
        if all_value is None:
            all_value = values
        else:
            try:
                all_value += values
            except:
                print(values)
                print(all_value)
                quit()

all_value = all_value / 10
all_value = all_value.tolist()
for line in all_value:
    line[0] = int(line[0])

with open("all.csv", "w", newline="", encoding="utf-8") as f:
    writer = csv.writer(f)
    writer.writerow(column)
    writer.writerows(all_value)
